﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserPermission.aspx.cs"
    Inherits="Skyworth.CRM.Web.SystemManagement.UserPermission" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>查看用户权限</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <%--[if IE]>
     <link href="../themes/css/ieHack.css" rel="stylesheet" type="text/css" />
    <![endif]--%>
    <link href="../themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/core.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/pages.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/Messagebox.css" rel="stylesheet" type="text/css" />

    <script src="../javascripts/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../javascripts/MessageBox.js" type="text/javascript"></script>

    <script src="../javascripts/jquery.autocomplete.js" type="text/javascript"></script>

    <script src="../javascripts/json2.js" type="text/javascript"></script>

    <script type="text/javascript">
        $().ready(function() {
            $("#txtUserName").autocomplete("../Service/Userhandler.ashx",
               { minChars: 1,
                   autoFill: false,
                   /*width: "200px",*/
                   scroll: false,
                   mustMatch: true,
                   selectFirst: true,
                   formatItem: function(result, i, max) {
                       //return i + "/" + max + ": \"" + result[0] + "\" [" + result[1] + "]";
                       var item = "<table id='auto" + i + "' style='width:100%;'><tr><td align='left'>"
                                + result[1] + "</td><td align='right' style='color:green;'>"
                                + result[2] + "</td></tr></table>";
                       return item;
                   },
                   formatMatch: function(row, i, max) {
                       return row[0] + " " + row[1];
                   },
                   formatResult: function(row) {
                       return row[1];
                   }
               });
            $("#txtUserName").result(function(event, data, formatted) {
                $("#txtUserId").val(data[0]);
            });

            $("#btnOk").click(function() {
                var userName = $("#txtUserName").val();
                var userId = $("#txtUserId").val();
                if ("" == userId || "" == userName) {
                    $.Messager.Alert({ Title: '系统消息', Message: "请选择一个合法的用户！", Icon: IconType.Warning });
                    return false;
                }

            })

            $(".tableList table.list tbody tr[class!='tableHeader']").hover(function() { $(this).addClass("hover"); },
                                                    function() { $(this).removeClass("hover"); })

        });    
    </script>

</head>
<body style="overflow: visible;">
    <div>
        <form id="form1" runat="server">
        <div>
            <div >
                <div class="pageHeader">
                    <div class="searchBar">
                        <ul>
                            <li style="float: left;"><span>系统模块：</span>
                                <asp:DropDownList ID="ddlModules" runat="server" AppendDataBoundItems="True" DataTextField="ModuleName"
                                    DataValueField="ModuleID">
                                </asp:DropDownList>
                            </li>
                            <li style="float: left; margin-left:10px"><span>用户名称：</span><asp:TextBox ID="txtUserName" runat="server"
                                CssClass="txt"></asp:TextBox><asp:HiddenField ID="txtUserId" runat="server" />
                            </li>
                            <li style="float: left; padding-left: 10px">
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <asp:Button ID="btnOk" runat="server" Text="查询" CssClass="serverButton" OnClick="btnOk_Click" />
                                    </div>
                                </div>
                            </li>
                            <li style="clear: both"></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div >
                <div class="tableList">
                    <asp:GridView ID="gvModuleView" runat="server" DataKeyNames="MenuID,pageFunction,pageAuthority"
                        CssClass="list" Width="100%" AllowSorting="True" AutoGenerateColumns="False"
                        OnRowDataBound="ModuleView_RowDataBound" GridLines="None" AlternatingRowStyle-CssClass="trbg"
                        HeaderStyle-CssClass="tableHeader">
                        <Columns>
                            <asp:TemplateField HeaderText="页面名称">
                                <ItemTemplate>
                                    <asp:Label ID="lab_ID" runat="server" Text='<%# Eval("MenuID")%>' Style="display: none"></asp:Label>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("MenuName") %>'></asp:Label>
                                    <asp:Label ID="lab_Verify" runat="server" Text="" Style="display: none"></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Wrap="False" Width="150px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="功能列表">
                                <ItemTemplate>
                                    <asp:CheckBoxList ID="AuthorityList" runat="server" RepeatDirection="Horizontal" Enabled="false"
                                        RepeatLayout="Flow">
                                    </asp:CheckBoxList>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </div>
            </div>
        </div>
        </form>
    </div>
</body>
</html>
